package com.jxzyk.model;

import java.net.URL;

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.Window;
import android.view.WindowManager;
import android.widget.MediaController;
import android.widget.VideoView;

import com.core.util.T;
import com.jxzyk.adapter.OutlineAdapter;

//@ContentView(R.layout.act_video)
public class VideoActivity extends Activity {
	// @ViewInject(R.id.video)
	private VideoView videoView;
	private String url;

	@Override
	protected void onCreate(Bundle bundle) {
		super.onCreate(bundle);
		// 隐藏标题栏
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		// 隐藏状态栏
		// 定义全屏参数
		int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
		// 获得当前窗体对象
		Window window = VideoActivity.this.getWindow();
		// 设置当前窗体为全屏显示
		window.setFlags(flag, flag);
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
		bundle = getIntent().getExtras();
		url = bundle.getString(OutlineAdapter.TAG);
//		url = "http://120.195.54.8:801/videoplayer/n0016v9g8yo.mp4?ich_u_r_i=b03a9a4c940ab0bab65a3b208fe526bc&ich_s_t_a_r_t=0&ich_e_n_d=0&ich_k_e_y=e8ff7e5414051aa99b4efc35af3e4befed1d69657cbf131d660566653a81cb02&ich_t_y_p_e=7061&ich_d_i_s_k_i_d=3&ich_s_e_q=694927867&ich_u_n_i_t=1";
		videoView = new VideoView(this);
		setContentView(videoView);
		try {
			Uri uri = Uri.parse(url);
			videoView.setMediaController(new MediaController(this));
			videoView.setVideoURI(uri);
			videoView.requestFocus();
		} catch (Exception e) {
			e.printStackTrace();
		}
		videoView.start();
	}

	// @Override
	// public void initData(Bundle bundle) {
	// setOrientation();
	// bundle = getIntent().getExtras();
	// url = bundle.getString(OutlineAdapter.TAG);
	// }

	// @Override
	// public void initUi() {
	// Uri uri = Uri
	// .parse("http://120.195.54.8:801/videoplayer/n0016v9g8yo.mp4?ich_u_r_i=b03a9a4c940ab0bab65a3b208fe526bc&ich_s_t_a_r_t=0&ich_e_n_d=0&ich_k_e_y=e8ff7e5414051aa99b4efc35af3e4befed1d69657cbf131d660566653a81cb02&ich_t_y_p_e=7061&ich_d_i_s_k_i_d=3&ich_s_e_q=694927867&ich_u_n_i_t=1");
	// videoView.setMediaController(new MediaController(this));
	// videoView.setVideoURI(uri);
	// videoView.start();
	// videoView.requestFocus();
	// }

}
